<?php


namespace app\api\model\view;

use app\logic\model\view\OrderOpus_Opus_OpusNumber_buyer_writerView as model;
class OrderOpus_Opus_OpusNumber_buyer_writerView extends model
{
    function getList($param,$field,$limit,$order,$isPage=true){
        $list=$this->where(function($q) use ($param){
                if(check_request($param,"opus_id")){
                    $q->where("opus_id","{$param['opus_id']}");
                }
                if(check_request($param,"order_pay_id")){
                    $q->where("order_pay_id","{$param['order_pay_id']}");
                }
                if(check_request($param,"status")){
                    if($param['status']==">1"){
                        $q->where("status",'>=',1);
                    }else{
                        $q->where("status","{$param['status']}");
                    }
                }
                if(check_request($param,"opus_number_id")){
                    $q->where("opus_number_id","{$param['opus_number_id']}");
                }
            })
            ->field($field);
        if($isPage){
            $list=$list->paginate($limit);
        }else{
            $list=$list->limit($limit)->select();
        }
        if(!$list->isEmpty()){
            return $list->toArray();
        }
        return $list;
    }
}